import { request } from '@/utils/request';
import CRUD from '@/utils/request/CRUD';

// 施工列表CRUD
export const engineeringListCRUD = CRUD('/system/engineering');

// 修改状态
export function updateStatus(data: Record<string, any>) {
  return request.put({
    url: '/system/engineering/update-status',
    data,
  });
}

// 转派监理
export function updateSupervision(data: Record<string, any>) {
  return request.post({
    url: '/system/engineering/update-supervision',
    data,
  });
}

// 转派工程部经理
export function updateEngineeringManager(data: Record<string, any>) {
  return request.post({
    url: '/system/engineering/update-engineering-manager',
    data,
  });
}
// 获取监理接口
export function getSupervisionList(params: Record<string, any>) {
  return request.get({
    url: '/system/engineering/get-supervision',
    params,
  });
}

// 生成产品订单
export function createProductOrder(data: Record<string, any>) {
  return request.post({
    url: '/system/product-order/create',
    data,
  });
}

// 发起结算审批
export function startSettlementApproval(data: Record<string, any>) {
  return request.post({
    url: '/system/engineering-accounting-expenses/start-settlement-approval',
    data,
  });
}
// 施工核算费用CRUD
export const engineeringAccountingCRUD = CRUD('/system/engineering-accounting-expenses');

// 更改施工模板
export function updateEngineeringTemplate(data: Record<string, any>) {
  return request.post({
    url: '/system/engineering-stage/update-engineering-stage-template',
    data,
  });
}